$(function () {
    
    $("#sbmit").click(function (index) {
        var username=$("#username").val();
        var password=$("#password").val();
        if(username==null || password==null || username=="" ||password==""){
            $.messager.alert('警告','用户名和密码不能为空');
        }else{
            $.ajax({
                url: 'user/login',
                method: "POST",
                data:{
                  username:username,
                  password:password
                },
                success: function (data) {
                    if(data.status=="success"){
                        $.messager.alert('提示',data.msg);
                        location.href="user/home";
                    }else{
                        $.messager.alert('提示',data.msg);
                    }
                }
            })
        }
    })
})
